﻿using System.Windows.Media;
using System.Xml;
using Blackbird.Common.Properties;
using Blackbird.Core.Editable.Base;
using Blackbird.Core.Editable.Frames;

namespace Blackbird.Core.Editable.Map
{
    public class EditableStaticMapNode : BaseEditableMapNode
    {
        public override ImageSource ImageSource { get { return Frame.BitmapSource; } }

        public EditableFrame Frame { get; set; }

        protected override void WriteXmlAttributes(XmlWriter writer)
        {
            
        }

        protected override void WriteXmlContent(XmlWriter writer)
        {
            writer.WriteStartElement("frame");
            Frame.WriteXml(writer);
            writer.WriteEndElement();
        }

        public override string TypeName
        {
            get { return Resources.EditableStaticMapNodeTypeFiendlyName; }
        }

        protected override void ReadXmlAttributes(XmlReader reader)
        {
            
        }

        protected override void ReadXmlContent(XmlReader reader)
        {
            reader.ReadStartElement("frame");
            reader.MoveToContent();
            Frame = new EditableFrame();
            Frame.ReadXml(reader);
            reader.ReadEndElement();
        }
    }
}